<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <input type="hidden" id="orderid">
    <div id="code"></div>
    <button id="butt" >点击支付</button>
</body>
<script type="text/javascript" src="js/jquery-1.8.3.min.js" ></script>
<script type="text/javascript" src="js/qrcode.js" ></script>
<script>
    var flag=false;
    var aa=setInterval(function () {
       if (flag){
           $.ajax({
               type:"post",
               url:"http://adu867g.hn3.mofasuidao.cn/wechat/gueryorder",
               data:{"orderid":$("#orderid").val()},
               dataType:"json",
               success:function (data) {
                   if (data.code==0){
                       flag=false;
                        clearInterval(aa);
                        location.href="ok.html";
                   }
               }
           })
       }
    },3000)
    $("#butt").click(function () {
        $.ajax({
            type:"post",
            url:"http://adu867g.hn3.mofasuidao.cn/wechat/getQrCode",
            dataType:"json",
            success:function (data) {
                if (data.code==0){
                    new QRCode(document.getElementById("code"),data.data.code);
                    $("#orderid").val(data.data.orderid);
                    flag=true;
                }
            }
        })
    })
</script>
</html>